/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ep.persistence.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Spyros
 */
@Entity
@Table(name = "t001_user", catalog = "epresc", schema = "")
@NamedQueries({
    @NamedQuery(name = "T001User.findAll", query = "SELECT t FROM T001User t"),
    @NamedQuery(name = "T001User.findById", query = "SELECT t FROM T001User t WHERE t.id = :id"),
    @NamedQuery(name = "T001User.findByUsername", query = "SELECT t FROM T001User t WHERE t.username = :username"),
    @NamedQuery(name = "T001User.findByPassword", query = "SELECT t FROM T001User t WHERE t.password = :password"),
    @NamedQuery(name = "T001User.findByType", query = "SELECT t FROM T001User t WHERE t.type = :type")})
public class T001User implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "username")
    private String username;
    @Basic(optional = false)
    @Column(name = "password")
    private String password;
    @Basic(optional = false)
    @Column(name = "type")
    private short type;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "t001User", fetch = FetchType.LAZY)
    private Collection<T003Pharmacist> t003PharmacistCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "t001User", fetch = FetchType.LAZY)
    private Collection<T002Doctor> t002DoctorCollection;

    public T001User() {
    }

    public T001User(Integer id) {
        this.id = id;
    }

    public T001User(Integer id, String username, String password, short type) {
        this.id = id;
        this.username = username;
        this.password = password;
        this.type = type;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public short getType() {
        return type;
    }

    public void setType(short type) {
        this.type = type;
    }

    public Collection<T003Pharmacist> getT003PharmacistCollection() {
        return t003PharmacistCollection;
    }

    public void setT003PharmacistCollection(Collection<T003Pharmacist> t003PharmacistCollection) {
        this.t003PharmacistCollection = t003PharmacistCollection;
    }

    public Collection<T002Doctor> getT002DoctorCollection() {
        return t002DoctorCollection;
    }

    public void setT002DoctorCollection(Collection<T002Doctor> t002DoctorCollection) {
        this.t002DoctorCollection = t002DoctorCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof T001User)) {
            return false;
        }
        T001User other = (T001User) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ep.persistence.entities.T001User[id=" + id + "]";
    }

}
